package com.liang.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.liang.pojo.Category;
import com.liang.pojo.Store;
import com.liang.service.CategoryService;

@Controller
public class CategoryController {
	@Autowired
	CategoryService categoryService;
	@RequestMapping("/selectAllCategory")
	public String selectAllCategory(Model model) {
		List<Category> allCategory = categoryService.selectAllCategory();
		model.addAttribute("allCategory", allCategory);
		return null;
		
	}
	@RequestMapping("/selectCategoryById")
	public String selectCategoryById(@RequestParam("id")int id,Model model) {
		List<Store> allStore = categoryService.selectCategoryById(id);
		model.addAttribute("allStore", allStore);
		return null;
		
	}
}
